import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/login/index.vue'),
    },
    {
      path: '/',
      redirect: '/home',
      component: () => import('../views/layout/index.vue'),
      children: [
        {
          path: '/home',
          name: 'home',
          component: () => import('../views/home/index.vue'),
        },
        {
          path: '/category',
          name: 'category',
          component: () => import('../views/category/index.vue'),
        },
        {
          path: '/cart',
          name: 'cart',
          component: () => import('../views/cart/index.vue'),
        },
        {
          path: '/profile',
          name: 'profile',
          component: () => import('../views/profile/index.vue'),
        },
      ],
    },
  ],
})

export default router
